package com.mmall.concurrency.example.atomic;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;

/**
 * @Author: liqiang
 * @description: Oh my god!
 * @Date: Created in 22:26 2018/4/4
 * @Modified:
 */
@Slf4j
public class AtomicExcemple4 {

    private static AtomicReference<Integer> atomicReference = new AtomicReference<>(0);
    public static void main(String[] args) throws Exception {

        atomicReference.compareAndSet(0,2);
        atomicReference.compareAndSet(0,1);
        atomicReference.compareAndSet(2,3);
        atomicReference.compareAndSet(3,5);
        atomicReference.compareAndSet(4,6);

        log.info("result : {}",atomicReference.get());
    }
}
